<template>
  <div class="search_body">
    <div class="search_input">
      <div class="demo-input-suffix">
        <el-row :gutter="20">
          <el-input class="el_input" v-model="input2" placeholder="搜索" prefix-icon="el-icon-search" clearable/>
        </el-row>
      </div>
    </div>
    <div class="search_result">
      <h3>电影/电视剧/综艺</h3>
      <div class="infinite-list-wrapper" style="overflow: auto">
        <ul v-infinite-scroll="load" class="list" infinite-scroll-disabled="disabled">
          <li v-for="i in count" :key="i" class="list-item">{{ i }}</li>
        </ul>
        <p v-if="loading">Loading...</p>
        <p v-if="noMore">No more</p>
      </div>

      <!--      <ul>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>
              <li>
                <div class="img"><img src="images/movie_1.jpg"></div>
                <div class="info">
                  <p><span>无名之辈</span><span>8.5</span></p>
                  <p>A Cool Fish</p>
                  <p>剧情,喜剧,犯罪</p>
                  <p>2018-11-16</p>
                </div>
              </li>

            </ul>-->



    </div>
  </div>

</template>

<script>
import {defineComponent, ref,computed , } from 'vue'
// import {Toast} from '@nutui/nutui';

export default defineComponent({
  name: "Search",
  setup() {
    const count = ref(10)
    const loading = ref(false)
    const noMore = computed(() => count.value >= 20)
    const disabled = computed(() => loading.value || noMore.value)
    const load = () => {
      loading.value = true
      setTimeout(() => {
        count.value += 2
        loading.value = false
      }, 2000)
    }

    return {
      input2: ref(''), count, loading, noMore, disabled, load,
    }

  }
})
</script>

<style scoped>
.infinite-list-wrapper {
  /*height:100%;*/
  text-align: center;
}
.infinite-list-wrapper .list {
  padding: 0;
  margin: 0;
  list-style: none;
}
.infinite-list-wrapper .list-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  background: var(--el-color-danger-lighter);
  color: var(--el-color-danger);
}
.infinite-list-wrapper .list-item + .list-item {
  margin-top: 10px;
}

.el_input {

}

.el_input >>> .el-input__inner {
  border-radius: 30px; /*输入框圆角值*/
}

.demo-input-suffix {
  /*margin-bottom: 16px;*/
}

.search_body {
  flex: 1;
  overflow: auto;
  width: 100%;
  height: 100%;
  /*margin-top: 53px;*/
  position: absolute;
  top: 0;

}

.search_body .search_input {
  padding: 8px 18px;
  background-color: #f5f5f5;
  border-bottom: 1px solid #e5e5e5;
  margin-top: 53px;
}

.search_body .search_input_wrapper {
  padding: 0 10px;
  border: 1px solid #e6e6e6;
  border-radius: 5px;
  background-color: #fff;
  display: flex;
  line-height: 20px;
}

.search_body .search_input_wrapper i {
  font-size: 16px;
  padding: 4px 0;
}

.search_body .search_input_wrapper input {
  border: none;
  font-size: 13px;
  color: #333;
  padding: 4px 0;
  outline: none;
  margin-left: 5px;
  width: 100%;
}

.search_body .search_result {
  width: 100%;
  /*height: auto;*/
  overflow: auto;
}

.search_body .search_result h3 {
  font-size: 15px;
  color: #999;
  padding: 9px 15px;
  border-bottom: 1px solid #e6e6e6;
}

.search_body .search_result ul {
}

.search_body .search_result li {
  border-bottom: 1px #c9c9c9 dashed;
  padding: 10px 15px;
  box-sizing: border-box;
  display: flex;
}

.search_body .search_result .img {
  width: 60px;
  float: left;
}

.search_body .search_result .img img {
  width: 100%;
}

.search_body .search_result .info {
  float: left;
  margin-left: 15px;
  flex: 1;
}

.search_body .search_result .info p {
  height: 22px;
  display: flex;
  line-height: 22px;
  font-size: 12px;
}

.search_body .search_result .info p:nth-of-type(1) span:nth-of-type(1) {
  font-size: 18px;
  flex: 1;
}

.search_body .search_result .info p:nth-of-type(1) span:nth-of-type(2) {
  font-size: 16px;
  color: #fc7103;
}
</style>